mkdir -p bin
cd bin
rm -rf user-data.yaml
cat > user-data.yaml <<EOF
#cloud-config
password: 123
chpasswd:
  expire: False
ssh_pwauth: True
EOF

cloud-localds init.img user-data.yaml

UBUNTU_IMG=ubuntu-20.04-server-cloudimg-amd64.img

if [ ! -f "$UBUNTU_IMG" ]; then
    wget https://cloud-images.ubuntu.com/releases/focal/release/ubuntu-20.04-server-cloudimg-amd64.img
fi

if [ ! -f "ubuntu.img" ]; then
    sudo qemu-img create -f qcow2 -o backing_file=${UBUNTU_IMG} ubuntu.img
    sudo qemu-img resize ubuntu.img 5G
fi

cd ..